package dao.oc_voyage;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import java.util.List;

import entitybean.oc_voyage.EnitityBeanOc_Voyage;
import entitybean.oc_voyage_ice.EnitityBeanOc_Voyage_Ice;

public class DaoImpl_Oc_Voyage  extends HibernateDaoSupport implements Dao_Oc_Voyage{
	public void Insert_Oc_Voyage(EnitityBeanOc_Voyage e)
	{
		this.getHibernateTemplate().save(e);
	}
	public void Update_Oc_Voyage(EnitityBeanOc_Voyage e)
	{
		this.getHibernateTemplate().update(e);
	}
	public void Delete_Oc_Voyage(EnitityBeanOc_Voyage e)
	{
		this.getHibernateTemplate().delete(e);
	}
	@SuppressWarnings("unchecked")
	public void Delete_Oc_Voyage(String id)
	{
		List<EnitityBeanOc_Voyage> list=this.getHibernateTemplate().find("from EnitityBeanOc_Voyage where del='OFF' and id in("+id+")");	
		for(int i=0;i<list.size();i++)
		{
			EnitityBeanOc_Voyage e=list.get(i);
			e.setDel("ON");
			this.getHibernateTemplate().update(e);
			
		}
		
	}
	@SuppressWarnings("unchecked")
	public List<EnitityBeanOc_Voyage> Find_Oc_Voyage_By_boatid(Integer id)
	{
		return this.getHibernateTemplate().find("from EnitityBeanOc_Voyage where boatid="+id);
	
	}
	@SuppressWarnings("unchecked")
	public EnitityBeanOc_Voyage Find_Oc_Voyage_By_id(String id)
	{
		List<EnitityBeanOc_Voyage>list=this.getHibernateTemplate().find("from EnitityBeanOc_Voyage where id="+id);
		EnitityBeanOc_Voyage e=new EnitityBeanOc_Voyage();
		if (list.size()>0)
		{
			e=list.get(0);	
		}
		return e;
		
	}
}
